var idolId;
var idolNickname;
var idolPortrait;
var idolType;
Attention={
		ajaxPayattention:function() {
			$.ajax({
				url : "/skyline/attention/payattention.html",
				type : "POST",
				data : "idolId=" + idolId + "&idolNickname=" + idolNickname
						+ "&idolPortrait=" + idolPortrait + "&idolType=" + idolType,
				dataType:"json",
				contentType : "application/x-www-form-urlencoded; charset=utf-8",
				success : function(msg) {
					var obj = msg;
					if (obj == null) {
					// alert("wrong");
					} 
					if(obj.loginStatus){
						document.getElementById(idolId+"_attention").value="取消关注";
						document.getElementById(idolId+"_attention").onclick=Attention.ajaxDelattention;
					}else{
						ajaxLogin();
					}
				}
			});
		},

		ajaxDelattention:function() {
			$.ajax({
				url : "/skyline/attention/delattention.html",
				type : "POST",
				data : "idolId=" + idolId + "&idolType=" + idolType,
				dataType:"json",
				contentType : "application/x-www-form-urlencoded; charset=utf-8",
				success : function(msg) {
					var obj = msg;
					if (obj == null) {
						alert("wrong");
					} else {
						document.getElementById(idolId+"_attention").value="关注";
						document.getElementById(idolId+"_attention").onclick=Attention.ajaxPayattention;
					}
				}
			});
		},
		ajaxIsAttention:function(id,nickname,portrait,type){
			idolId=id;
			idolNickname=nickname;
			idolPortrait=portrait;
			idolType=type;
			$.ajax({
				url:"/skyline/attention/isattention.html",
				type:"POST",
				data:"idolId="+idolId + "&idolType=" + idolType,
				dataType:"json",
				contentType : "application/x-www-form-urlencoded; charset=utf-8",
				success : function(msg) {
					var obj = msg;
					if (obj == null) {
					// ajaxLogin();
					} else {
						if(obj.UserStatus==true){
							if(obj.IsFanFlag){
								document.getElementById(idolId+"_attention").value="取消关注";
								document.getElementById(idolId+"_attention").onclick=Attention.ajaxDelattention;
							}
							else{
								document.getElementById(idolId+"_attention").value="关注";
								document.getElementById(idolId+"_attention").onclick=Attention.ajaxPayattention;
							}
						}
						else if(obj.UserStatus==false){
							document.getElementById(idolId+"_attention").value="关注";
							document.getElementById(idolId+"_attention").onclick=ajaxLogin;
						}	else if(obj.UserStatus=="Me")	{
							document.getElementById(idolId+"_attention").type="hidden";
						}
					}
				}
			});
		}
}



